<template>
    <el-menu unique-opened active-text-color="#ffd04b" class="el-menu-vertical-demo" default-active="2" router>
        <el-menu-item index="/home">
            <el-icon>
                <HomeFilled />
            </el-icon>
            <span>管理中心</span>
        </el-menu-item>

        <el-sub-menu :index="item.id + ''" v-for="item in permission" :key="item.id">
            <template #title>
                <el-icon>
                    <component :is="item.icon" />
                </el-icon>
                <span>{{ item.title }}</span>
            </template>
            <el-menu-item v-for="val in item.children" :key="val.id" :index="val.url">{{ val.title }}</el-menu-item>
        </el-sub-menu>
    </el-menu>
</template>

<script setup>
const { permission } = JSON.parse(localStorage.getItem('adminLoginInfo') || '{}')
</script>

<style lang="scss" scoped>
.el-menu {
    border-right: 0;
}
</style>